UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e7FN1VGAnN7XMxfxQ0YXm7LGk2s9C7x2WgPRE1n8G0Y='
WHERE
key_id = 'c4c74092b8173d71f9e65905a3d5b25144ee7e026daf94ac3d0d4bf51147bce4'
AND (
token = 'e7FN1VGAnN7XMxfxQ0YXm7LGk2s9C7x2WgPRE1n8G0Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)