UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AYAZo49dUyxj4GEnWQvsH3C3RDYEP284PWtbegzVo9A='
WHERE
key_id = '3b34b2991eb82f192718c7ce508284fed2d1d3df2af9229e96b82fc022639e60'
AND (
token = 'AYAZo49dUyxj4GEnWQvsH3C3RDYEP284PWtbegzVo9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)