UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tkuVmuizvhEcEsvicvuzORY4d9JhIzA3fKli7DOzx8w=' 
WHERE 
  key_id = '8ad31504b69bd858cfe6999d3709ede34a561de269a5901fd77f921895884ff2' 
  AND (
    token = 'tkuVmuizvhEcEsvicvuzORY4d9JhIzA3fKli7DOzx8w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058