UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5B58jcbFT/+vLgFuY0wT9f5XMXlVwOOGmCWBFXl60+0='
WHERE
key_id = '9d0ea03209de7931fc8b37d5170cedba032331da1aeb24c0280b20b6431cbfbd'
AND (
token = '5B58jcbFT/+vLgFuY0wT9f5XMXlVwOOGmCWBFXl60+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)