UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5BrF6NXUtIDfcWeXcXRwLgUuTcz9WKpGYyMDUSv2pl0='
WHERE
key_id = 'e89428f6e55914770cc2ead1ff8c3647d8d96eacd5dd55f274fd25d19286b9da'
AND (
token = '5BrF6NXUtIDfcWeXcXRwLgUuTcz9WKpGYyMDUSv2pl0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)