UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vd5TVWfJPh6F+vKIwUpvOAEMFp50whQI/C9zXxLiFLs=' 
WHERE 
  key_id = '3c9c39fed9ec757f396bcd578f8750ec4e839f3a1ee981f31a74a8145acb7bd4' 
  AND (
    token = 'Vd5TVWfJPh6F+vKIwUpvOAEMFp50whQI/C9zXxLiFLs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034