UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'At7rJK3bdTEyyBCc/Yc71dNiXVjgqaid2tVOn3G5azc='
WHERE
key_id = '6218fd64d6341d4301d0c495c0070c68dc4d9c9cef55ff33ffb1848f0ecdc4ff'
AND (
token = 'At7rJK3bdTEyyBCc/Yc71dNiXVjgqaid2tVOn3G5azc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)