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