UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EmRNhp9cBr79KXNQ4Qf+yjftW4e1qdelTWzZSLrFpeM=' 
WHERE 
  key_id = 'd4ddcfa1ccef27a73ac4894fc9784b96895093c1c9edca5afbb94f3f6cc5ed2a' 
  AND (
    token = 'EmRNhp9cBr79KXNQ4Qf+yjftW4e1qdelTWzZSLrFpeM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037