UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZTRspRsgs+upGnAstH1F84t2ocLP3XjhOIKcMVT8YLg=' 
WHERE 
  key_id = '099ecb98b7b9834dac2a3c9e30adb838623d2f84d2e17a1f234e216baf3b8969' 
  AND (
    token = 'ZTRspRsgs+upGnAstH1F84t2ocLP3XjhOIKcMVT8YLg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024