UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0R9cDrfSVV0v+YLTWFB1kpAwrXHzW7c1PivPlttnf2A=' 
WHERE 
  key_id = '3160215aea3ab46e430f3e71b2ea102d2de7e1cba509045a27d7e7385bdda546' 
  AND (
    token = '0R9cDrfSVV0v+YLTWFB1kpAwrXHzW7c1PivPlttnf2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033