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