UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kW4Nk9xNqF7JceRjnM3u8+t7XLbqVuv0Drm3X36dkpI='
WHERE
key_id = '40eb8c10a7c26e2a494370e4834e2701fe0e8ba5908c6256a5139068023f39f1'
AND (
token = 'kW4Nk9xNqF7JceRjnM3u8+t7XLbqVuv0Drm3X36dkpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)