UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8qo3P5gpYLIQtHXXErJ9WUTCXbN03ZFeViKQYk32WkA='
WHERE
key_id = '36f21db3b36dfe99492bcb93a6c397359350e79071fc4c211a2fd76963fa5d40'
AND (
token = '8qo3P5gpYLIQtHXXErJ9WUTCXbN03ZFeViKQYk32WkA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)