UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TgmKIaBtX50Z+p2WmToMxwJz2BaoENj6IrneFrK2SIg='
WHERE
key_id = 'b00ce4fbba884bfd4645fe16714f4e16b4bd7aa6e778d21d1102c8808e4f2d43'
AND (
token = 'TgmKIaBtX50Z+p2WmToMxwJz2BaoENj6IrneFrK2SIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)