UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LBACzeJ14u29ahgiiCG7dGGKNSqIe0QMnIohr8N8IA8='
WHERE
key_id = '1e662ee8ba15b9e4a45bb3f197f6dfbc603de988984a207899aa95e8d965f207'
AND (
token = 'LBACzeJ14u29ahgiiCG7dGGKNSqIe0QMnIohr8N8IA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)