UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b2W1eNdMCXw0T8Sa8pOWDB/UjFzp47Tu0Yb/xQfS1pw=' 
WHERE 
  key_id = 'c19893f13559853c0ca327d546d886ca8cac05d710e7cba84bd2b212145973b7' 
  AND (
    token = 'b2W1eNdMCXw0T8Sa8pOWDB/UjFzp47Tu0Yb/xQfS1pw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027