UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S6dhQIaB1ggU9BRroKXFhNUEMhzl+sr/1nzojw703Pc='
WHERE
key_id = '65d845ccbd34d0a824238612c801f04638cf277048f2becfa6d6d2fb864a3470'
AND (
token = 'S6dhQIaB1ggU9BRroKXFhNUEMhzl+sr/1nzojw703Pc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)