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