UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hJhlE7TuuxZl485VeCWgV/bOdIRZTrKhC6hki8LLyD0='
WHERE
key_id = 'd7e4eb258777231096ef6912f880fa7054180a63c5f6295b16696495f6bd1df6'
AND (
token = 'hJhlE7TuuxZl485VeCWgV/bOdIRZTrKhC6hki8LLyD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)