UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jI9r5VnIz38nc1y63nDGvHUZWHnqoMrvBz9sT1FBJJE='
WHERE
key_id = 'e506b97675012978bfa3cad6bc3e07e7795d479f1ef357e978260ae0d8feae50'
AND (
token = 'jI9r5VnIz38nc1y63nDGvHUZWHnqoMrvBz9sT1FBJJE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)