UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q278kQ8jco4Y+lFzpX/ivhrygEltbAdJkfTCx7TSS6A='
WHERE
key_id = 'fd7991331bf22d6601cdee27b54e1f03005bb94633adac861b4ca766267e37b2'
AND (
token = 'q278kQ8jco4Y+lFzpX/ivhrygEltbAdJkfTCx7TSS6A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)