UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zt+9tHL+NUPDu/xU0D58rwtGj7w/DHqdjQodzX60w9c=' 
WHERE 
  key_id = 'f31b9c70cd83ef40f536b7d68d7690a3f913a106755e040e5ec2565e9889f27e' 
  AND (
    token = 'Zt+9tHL+NUPDu/xU0D58rwtGj7w/DHqdjQodzX60w9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060