UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p91sbeeXp0/Im7MifkowXTllG99PvT78SfaiLAXdIRs=' 
WHERE 
  key_id = '916d7718608bb155f8fe2e928a946410ff0ca40130a7cecfda628febbec7b4cc' 
  AND (
    token = 'p91sbeeXp0/Im7MifkowXTllG99PvT78SfaiLAXdIRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024