UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MD5tJ9DVS2pHZl5O0IqRKI9hHE8QEqjadrRktzsgbUE='
WHERE
key_id = 'b8e249058968e05192914aa0ed0ab370f138a660704549373331c0913c0cef48'
AND (
token = 'MD5tJ9DVS2pHZl5O0IqRKI9hHE8QEqjadrRktzsgbUE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)