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