UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VdJQeaD5DAqchq4ouXD7zFPmYAOoy7xE5mz/OTu/r5U='
WHERE
key_id = '5305f1117e3d78dbbb637a6071fdfa8fdf09496a7d05801665f34f7175e81404'
AND (
token = 'VdJQeaD5DAqchq4ouXD7zFPmYAOoy7xE5mz/OTu/r5U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)