UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SHP49L9sZnXP4e/C2FxSjH6gMR4/U2QZvw+g56NzhuM='
WHERE
key_id = 'c3bc19744c525c8508b9b841d50452dabba153430193018f3f35d745b5e7321d'
AND (
token = 'SHP49L9sZnXP4e/C2FxSjH6gMR4/U2QZvw+g56NzhuM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)