UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X5FM0BWcYGogEYYkWQW7r5KibatiC34XoEHYhGh/S10=' 
WHERE 
  key_id = 'ed28e76908bf283c0a1594311d4340374bf11b9dff6e083e3d9d645f78fa2b79' 
  AND (
    token = 'X5FM0BWcYGogEYYkWQW7r5KibatiC34XoEHYhGh/S10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022