UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qTt0rJZBzwEVClYG3krjNd+k99iMX6prWv4lKM0ojB8='
WHERE
key_id = 'b13be4014ba7605e4eb8328566cc03b0594e72a95d5becc4af69775ffca1a918'
AND (
token = 'qTt0rJZBzwEVClYG3krjNd+k99iMX6prWv4lKM0ojB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)