UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x4AFw4Hvw2+ByAU1nhJQbCaYPqmMkNO3DS6HEjYXIEc=' 
WHERE 
  key_id = 'a461e877b221a603d1647315906e2d8c815f11193a365e9377eb6225f9ff1231' 
  AND (
    token = 'x4AFw4Hvw2+ByAU1nhJQbCaYPqmMkNO3DS6HEjYXIEc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032