UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ynekdCqZpb/VIC89myJUXT76Y2sxEMwyzJ6YP7gBeUs=' 
WHERE 
  key_id = 'a34a3668f23b5aa32fd1bc19593f6e8650e6351fdb1caf4e803bbd080659e130' 
  AND (
    token = 'ynekdCqZpb/VIC89myJUXT76Y2sxEMwyzJ6YP7gBeUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043