UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R5m7WXnODYZ9BB3UMnOMa3MUkn0lMWZw6Pik8+Ap0gU=' 
WHERE 
  key_id = '0c6278e01486f75271e85357b271c0f283ce4570ada7897297a2a99d801be53e' 
  AND (
    token = 'R5m7WXnODYZ9BB3UMnOMa3MUkn0lMWZw6Pik8+Ap0gU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056