UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Knfj08jHyVXqcUe2FD0K1Qrffcwbyn71jWSNr+rMbU='
WHERE
key_id = '17761571268d8d0de05b084ece456a0f89996cc55011fa9fa3ab0554885e86d5'
AND (
token = '8Knfj08jHyVXqcUe2FD0K1Qrffcwbyn71jWSNr+rMbU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)