UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tRP3aLtH2ABL8SN6wydT7s4R1L74eg/npLsGXzivlo0=' 
WHERE 
  key_id = '7de22513c26889bd6767f8db4685995dc521953cf6b59c34d6b4b8ef3b25473c' 
  AND (
    token = 'tRP3aLtH2ABL8SN6wydT7s4R1L74eg/npLsGXzivlo0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037