UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P9pTN+lKbCOlz2FGqy18Qxk4sSoj6WT0XqDSu2BDt1A='
WHERE
key_id = '934467d34a792c830ce09907ac9fbb54c95dad68748c4058e86493fd93026e7a'
AND (
token = 'P9pTN+lKbCOlz2FGqy18Qxk4sSoj6WT0XqDSu2BDt1A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)