UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Izev/KWi/Um96xfo2yHkJwIUCXGnOxqhtG1ajujxOv4=' 
WHERE 
  key_id = '76ca0954c6d53b62cdb3f259c12eab42657fadb1c41c98734bc0af1172258791' 
  AND (
    token = 'Izev/KWi/Um96xfo2yHkJwIUCXGnOxqhtG1ajujxOv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029