UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iSCvvWCwBL2K910xqb7iQ+fqLf7hIldymhvgESmS998='
WHERE
key_id = '1b2b499aae1d7a7934709f6d2998188db0f164a5b7739bfad456e2f9b7f246b3'
AND (
token = 'iSCvvWCwBL2K910xqb7iQ+fqLf7hIldymhvgESmS998='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)