UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nBNOp67A/iW0EtanBuD7JrFEAUF77K0BYYGhrGpwysY=' 
WHERE 
  key_id = 'bf278c56bf1b9ed41ac1d5b887d81299cf29c19373e2a9a6ffb69cf373bbcbfb' 
  AND (
    token = 'nBNOp67A/iW0EtanBuD7JrFEAUF77K0BYYGhrGpwysY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031