UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h8RtsGkkDS1qpqGvJDzpzj1dNAVpJvNAqJ+F4cL0tIc='
WHERE
key_id = 'b8e5644c37e862bb44c19601676aee57d56f0227ab9837b0e5fc8c9e2792ebed'
AND (
token = 'h8RtsGkkDS1qpqGvJDzpzj1dNAVpJvNAqJ+F4cL0tIc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)