UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OxqQlOcFvPC2YIPePpuOVj6RcjrIodRfv4d74Gm8+zw='
WHERE
key_id = 'd2d12fac6f3346453f21f820df7058409f312ecde6630d3b0abb9b16497dacda'
AND (
token = 'OxqQlOcFvPC2YIPePpuOVj6RcjrIodRfv4d74Gm8+zw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)