UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ThZAQtRIn8U2tN6DR1aTOyqsiQr3MjCri6Mlcy+nM2U='
WHERE
key_id = 'ec9792ce621fe19526de833800295eecca2d8b5d0e39b36efbb92143229b44f7'
AND (
token = 'ThZAQtRIn8U2tN6DR1aTOyqsiQr3MjCri6Mlcy+nM2U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)