UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PgIJJjzuXyN6JZ4+yUx804DTWRTcp7TFF2aMxl4lWjU=' 
WHERE 
  key_id = '6f6d9b39534bf013fa6bce20d6cc22f5a43eb3e61b854d504f0b91f9946ee1eb' 
  AND (
    token = 'PgIJJjzuXyN6JZ4+yUx804DTWRTcp7TFF2aMxl4lWjU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038