UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ub3grcPVVVMJE2m5w059tTofN9KGmKMf3OVCU9lGx4E=' 
WHERE 
  key_id = '918a89875c11f82f85108d924a87df2fc22683db827536336d954cca816870b7' 
  AND (
    token = 'Ub3grcPVVVMJE2m5w059tTofN9KGmKMf3OVCU9lGx4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038