UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nZRbkacCZig9ryxCNyTkrA4Wwv6V8CFEdj8iLQ1h7gQ=' 
WHERE 
  key_id = '3db9cf872b08835c111d22aa50453c2b86417f06649bd452a0c5d6bd2d27e8ee' 
  AND (
    token = 'nZRbkacCZig9ryxCNyTkrA4Wwv6V8CFEdj8iLQ1h7gQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026