UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MHYraha4C5mhwfD2gw1R4XklnXAPAJ+JTp39mwBKDDM='
WHERE
key_id = 'b898396813750a139d230d004397e8ded7d2dc8fb4c5d4be857b39cce29100a8'
AND (
token = 'MHYraha4C5mhwfD2gw1R4XklnXAPAJ+JTp39mwBKDDM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)