UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dw2wK/JDNj45TmBl2PtJa2kF17Fbr6tanmWXJWPiTbU='
WHERE
key_id = 'af61a13700784e572c4493a4ee10acad6a17edc1c3f9544b1e53c4d2cba42592'
AND (
token = 'dw2wK/JDNj45TmBl2PtJa2kF17Fbr6tanmWXJWPiTbU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)