UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zSpAnhRLYiq7qK1WCLUGLwleOYl98QZFMKLyKW3Pv7w=' 
WHERE 
  key_id = '7011361f2deed8acd6b5184ed8c0542baf1ea8d291d9ef0567795e976a31c312' 
  AND (
    token = 'zSpAnhRLYiq7qK1WCLUGLwleOYl98QZFMKLyKW3Pv7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023