UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XhkZb+XM/51q3zeoXGpVhPSlux0gmLK9egY1d9ccGFg='
WHERE
key_id = 'f2ff4065b20da0772b360aa2825d395b5677a5a7f2b4ab2afb6ea1373972137a'
AND (
token = 'XhkZb+XM/51q3zeoXGpVhPSlux0gmLK9egY1d9ccGFg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)