UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ew+LNO7N2AxZYls3fkcVxyPStdtC+ss3nv1qqaX5Fxs='
WHERE
key_id = '3e27042fff689ba2cea7490245dc01bb42058bd27f50d3f2b6ba5fcbe545c004'
AND (
token = 'Ew+LNO7N2AxZYls3fkcVxyPStdtC+ss3nv1qqaX5Fxs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)