UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qvuEboKyct8AHZsPl8PMm5Rdo8EcOaSo1LwrwrZ10vs='
WHERE
key_id = '2d3baec6f6b99ae4f603108769ac3a4d84af178de05acef67c4f83a2ba400b98'
AND (
token = 'qvuEboKyct8AHZsPl8PMm5Rdo8EcOaSo1LwrwrZ10vs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)