UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gy9ymde/zFkXm1a7SOzzbhXMo07y+wZXiySxM8Od2Rg='
WHERE
key_id = 'f5cac0bb530f539adc0a0fe43f1ec1b7b54dccf318d5d765324ad34973322c52'
AND (
token = 'gy9ymde/zFkXm1a7SOzzbhXMo07y+wZXiySxM8Od2Rg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)