UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0fPwTPALH0GRo36xjGdd1xCPhaZKHplUKdkmLqml5G0='
WHERE
key_id = 'd637e79594c4c37035c14467103b48d8abf8ef987942f2d3e7a389e357a4b247'
AND (
token = '0fPwTPALH0GRo36xjGdd1xCPhaZKHplUKdkmLqml5G0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)