UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jDIFaLWJLvvJvl5fAQ8GDTynCgpsirPQ+ueEyetQoZ0=' 
WHERE 
  key_id = '6739e013c4ec371f044bc473b2df42d81fb44a7e35b4ba2743d1dbedc435d517' 
  AND (
    token = 'jDIFaLWJLvvJvl5fAQ8GDTynCgpsirPQ+ueEyetQoZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050