UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j0wELfVbNH4ZOX3TbyAhZ2LDxTwyss/O3g04T8DMdeg='
WHERE
key_id = '59164ea393c88fc53fb336088d562c3103db4e70e20ac8577a132fd43fd210e6'
AND (
token = 'j0wELfVbNH4ZOX3TbyAhZ2LDxTwyss/O3g04T8DMdeg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)