UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3uQBIcGQ+OtnFSuqcP0WkExMeEphB3o/tE+DMglRgB4='
WHERE
key_id = '8d4beedb2edc1981a8d8d677d38fab25d65a7f25d7cf263dfe75c970104fd223'
AND (
token = '3uQBIcGQ+OtnFSuqcP0WkExMeEphB3o/tE+DMglRgB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)