UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xTJ18FgAj88pDbgc7d0WqszeWCDGM5ybM5TVbkdh9e0=' 
WHERE 
  key_id = '51e932a8ac787703155b8aebfd24ec82870ac0d92829f02a763f55ad6a619d30' 
  AND (
    token = 'xTJ18FgAj88pDbgc7d0WqszeWCDGM5ybM5TVbkdh9e0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027