UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CQXGpXWwCwnGHPgWZS+v1FUWCY6oGB01vph8QyPzSbE=' 
WHERE 
  key_id = '80ba0a42401714f563caff9aa348dddd112c7f2fae30ca542941ee1bedb162aa' 
  AND (
    token = 'CQXGpXWwCwnGHPgWZS+v1FUWCY6oGB01vph8QyPzSbE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030